// Learn cc.Class:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html

/*
java 代码调用js代码
*/
let JCJ = cc.Class({
    properties:{

    },
    //开屏广告播放结束
     onSplashAdOver(){
         cc.log(" on splash ad play over ");
        cc.director.loadScene("mainScene");
    },

    onWxLoginSucess(code){
        if(!code)
        {
            cc.sys.localStorage.setItem("wxCode",code);
            let appId = cc.sys.localStorage.getItem("wxAppId");
            cc.tg.gameLogic.toLogin(code,appId);
        }
        else
        {
            cc.log("invalid code ",code);
        }
    },
    // 开红包广告播放完毕
    onOpenHBAdOver(){
        cc.tg.eventCenter.dispatchEvent("showPanel",{panelName:"openHB",active:false});
        cc.tg.eventCenter.dispatchEvent("showPanel",{panelName:'getHB',active:true});
    },




});
